﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SharpMap.Wpf
{
    /// <summary>
    /// Interaction logic for MapToolBar.xaml
    /// </summary>
    public partial class MapToolBar : UserControl
    {
        public MapToolBar()
        {
            InitializeComponent();
        }

        public FrameworkElement TargetView
        {
            get { return (FrameworkElement)GetValue(TargetViewProperty); }
            set { SetValue(TargetViewProperty, value); }
        }

        public static readonly DependencyProperty TargetViewProperty =
            DependencyProperty.Register("TargetView", typeof(FrameworkElement), typeof(MapToolBar),
            new FrameworkPropertyMetadata
                (
                default(FrameworkElement),
                TargetViewPropertyChanged));

        static void TargetViewPropertyChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
        {
            MapToolBar This = target as MapToolBar;
            if (This != null)
            {
                This.DataContext = new MapToolBarViewModel(This.TargetView);
            }
        }


        //-----------------------------------------------------
        //
        //  fields
        //
        //-----------------------------------------------------
    }
}
